<?php
/**
 * ExtGridColumnBase class file
 *
 * @author TrueSoftware B.V. (The Netherlands)
 * @link http://www.ext4yii.com
 * @copyright Copyright 2007-2010 TrueSoftwareB.V. all rights reserved.
 * @license http://www.ext4yii.com/license/
 *          EVALUATION VERSION - NOT FOR COMMERCIAL USE OR DISTRIBUTION.
 * @version 0.7.2
 */



abstract class ExtGridColumnBase extends ExtWidget
{
    private $_editor_class_types  = null;

    public function parseNode(ExtHTMLParserNode $node,
        ExtASTWalker $astwalker)
    {
        parent::parseNode($node, $astwalker);
        $this->parseRenderer($node,$astwalker);
        $this->parseGroupRenderer($node,$astwalker);
        $this->parseEditor($node,$astwalker);

        if($this instanceof ExtGridTemplateColumn)
        {
            $template = $this->parseXTemplate('template', 'tpl', $node, $astwalker);
        }
    }

    private function parseEditor($node,$astwalker)
    {
        if($this->parent->parent instanceof ExtEditorGridPanel)
        {
            if(is_null($this->getEditor()))
            {
                $editor = $node->findPropertyByName('editor');
                if(!is_null($editor))
                {
                    $items=parent::parseNodeWidthTag($editor,
                        $astwalker,
                        true,
                        array('asobject' => true),
                        $this,
                        $this->_editor_class_types);
                    $this->setEditor($items[0]);
                    $editor->shiftUp();
                }
            }
        }
        $node->shiftUp();
    }

    private function parseGroupRenderer($node,$astwalker)
    {
        $renderer = $this->parseScriptProperty('grouprenderer', 'groupRenderer', $node, $astwalker);
        if(!is_null($renderer))
            $this->setGroupRenderer($renderer);
    }

    private function parseRenderer($node,$astwalker)
    {
        $renderer = $this->parseScriptProperty('renderer', 'renderer', $node, $astwalker);
        if(!is_null($renderer))
            $this->setRenderer($renderer);
    }

    public function createContainer(ExtHTMLParserNode $node)
    {
        $node->shiftUp();
        return;
    }
}
?>
